import  string
upper = string.uppercase
lower = string.lowercase

def convert(str):
    temp=[]
    for i in str:
        if i in upper:
            temp.append(string.lower(i))
        else:
            temp.append(string.upper(i))
    return  string.join(temp,'')

print convert('Mr,Ed')
